﻿using AbpOne.Domain;
using AbpOne.Domain.Configurations;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Caching;
using Volo.Abp.Modularity;

namespace AbpOne.Application.Caching {
    [DependsOn(
        typeof(AbpCachingModule),
        typeof(AbpOneDomainModule)
    )]
    public class AbpOneApplicationCachingModule : AbpModule {
        public override void ConfigureServices(ServiceConfigurationContext context) {
            context.Services.AddStackExchangeRedisCache(options => {
                options.Configuration = AppSettings.Caching.RedisConnectionString;
                // Redis 实例名称，这里没填
                //options.InstanceName
                // Redis 的配置属性，如果配置了这个字，将优先于 Configuration 中的配置，同时它支持更多的选项。我这里也没填
                //options.ConfigurationOptions
            });
        }
    }
}